<template>
  <div>
    <panel v-if="work.length>0" :list="work" type="1"></panel>
    <div v-if="work.length==0" style="text-align: center;font-size: 22px;color: rgb(100,100,100);margin-top: 30px">暂无作品....</div>
  </div>
  </div>
</template>

<script>
  import { ButtonTab, ButtonTabItem, Panel } from 'vux'
  import { getToken } from "@/utils/auth"
  import { getDiscussion, getUserComment ,getUserWork} from "@/api/user"
  export default {
    components: {
      ButtonTab, ButtonTabItem, Panel
    },
    data() {
      return {
        token: "",
        discussions: [],
        comments: [],
        disShow: true,
        comentShow: false,
        work:[]
      }

    },
    created() {
      this.token = getToken()
      this.getWork()
    },
    methods: {
      getWork() {
        let token = this.token
        getUserWork(token).then((res) => {
          if (res.message == "ok") {
            this.work = res.work.map((item) => {
              item.src = item.avatar
              item.title = item.user
              item.desc = item.text
               var detail = encodeURIComponent(JSON.stringify(item))
              item.url = "/movie/detail?detail=" +detail
              return item
            })
          }
        })
      }
    }
  }

</script>

<style>

</style>